//这个是点开专场招聘某一场招聘的详情页

import Taro,{ useRouter } from "@tarojs/taro";
import { View,Image,Text } from "@tarojs/components";
import { useEffect,useState  } from "react";
import {getSpecialDetailInfo} from '../../api/mode'
import { CompanyCard } from "../../components";
import './index.scss'

export default function RecruitDetail(){

  const [detailInfo,setDetailInfo]=useState({})
  const [companyInfo,setCompanyInfo]=useState([])
  const router=useRouter()
  // console.log(router);
  useEffect(()=>{
    getSpecialDetailInfo(router.params.id).then(
      res=>{
        console.log(res.data.data);
        setDetailInfo(res.data.data);
        setCompanyInfo(res.data.data.companyUsersideInfoList)
      }
    )
  },[])


return (
<View>
    <View className='headCard'>
      <View className='CardTitle'>
        {detailInfo.recruitName}
      </View>
      <View className='at-row'>
          <Image src={'data:image/png;base64,'+detailInfo.photo}  className='at-col at-col-4 recruitDetailImage'>
          </Image>

        <View className='at-col at-col-8' style={{marginLeft:'10px'}}>
        <View className='recruitDetailTime'>
              {detailInfo.recruitStartTime}~{detailInfo.recruitEndTime}
        </View>

        <View className='companyFeature'>
          <View className='companyDetailFeature_item '  ><Text >{detailInfo.companyCount}家企业</Text></View>
          <View className='companyDetailFeature_item '  ><Text >{detailInfo.positionCount}个岗位</Text></View>
          </View>
        </View>
      </View>
    </View>

    <View className='centerCard'>
      <View className='CardTitle'>
        活动情况
      </View>
     
      <View className='centerContent'>
        <Text>活动时间 :  {detailInfo.recruitStartTime}~{detailInfo.recruitEndTime}</Text>
      </View>

      <View className='centerContent'>
        <Text>活动介绍 :  {detailInfo.introduction}</Text>
      </View>

      <View className='at-row centerContent'>
        <Text className='at-col at-col-3'>服务对象 :</Text>
        <View className='at-col at-col-9'>
        {detailInfo.audienceList?detailInfo.audienceList.map((Info,index)=>(<Text className='organization' key={index}>{Info}</Text>)):null}
        </View>
      </View>

      <View className='at-row centerContent'>
        <Text className='at-col at-col-3'>组织单位 :</Text>
        <View className='at-col at-col-9'>
        {detailInfo.organizationList?detailInfo.organizationList.map((Info,index)=>(<Text className='organization' key={index}>{Info}</Text>)):null}
        </View>
      </View>
    
    </View>
      {companyInfo?companyInfo.map((Info,index)=>(<CompanyCard key={index} Info={Info} companyId={Info.id} isSpecial={1}></CompanyCard>)):null}

</View>
)
}